<template>
  <el-table :data="list" style="width: 100%;padding-top: 15px;">
    <el-table-column label="订单号" min-width="200">
      <template slot-scope="scope">
        {{ scope.row.order_no | orderNoFilter }}
      </template>
    </el-table-column>
    <el-table-column label="下单价格" width="195" align="center">
      <template slot-scope="scope">
        ¥{{ scope.row.price | toThousandFilter }}
      </template>
    </el-table-column>
    <el-table-column label="检测状态" width="100" align="center">
      <template slot-scope="{row}">
        <el-tag :type="row.status | statusFilter">
          {{ row.status }}
        </el-tag>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>

export default {
  filters: {
    statusFilter(status) {
      const statusMap = {
        success: 'success',
        pending: 'danger'
      }
      return statusMap[status]
    },
    orderNoFilter(str) {
      return str.substring(0, 30)
    }
  },
  data() {
    return {
      list: [
        {
          order_no: 'bBBbD458-71Ff-bBaf-a4bb-1bD7dCC1fC5A',
          timestamp: 1052283831865,
          username: 'Robert Lewis',
          price: 3274.9,
          status: 'pending'
        },
        {
          order_no: '3fc8a3B9-c6aE-cCCf-bBEE-4b03FE4b7Cc3',
          timestamp: 1052283831865,
          username: 'Susan Thomas',
          price: 10785,
          status: 'success'
        },
        {
          order_no: 'FcBb938c-F659-dEcE-3B87-31EA29F9e1b0',
          timestamp: 1052283831865,
          username: 'Susan Thompson',
          price: 12114.18,
          status: 'pending'
        },
        {
          order_no: 'BDE54d9e-cA1f-5cf1-35db-f5829e98bc64',
          timestamp: 1052283831865,
          username: 'William Clark',
          price: 8772,
          status: 'pending'
        },
        {
          order_no: 'Ada7BbcD-bfB1-d6EE-62AF-7fBBEfcd490D',
          timestamp: 1052283831865,
          username: 'Jose Jackson',
          price: 12676.9,
          status: 'pending'
        },
        {
          order_no: 'e8399BdA-63C3-31a8-e73d-cDceeA4Eac90',
          timestamp: 1052283831865,
          username: 'Daniel Taylor',
          price: 5607.7,
          status: 'success'
        },
        {
          order_no: 'cD918829-5f24-620d-3E73-A7ADC9bEBDFE',
          timestamp: 1052283831865,
          username: 'Frank Perez',
          price: 12090.3,
          status: 'success'
        },
        {
          order_no: '25FdedA6-A32A-dDab-EDe1-6561c6A3b18a',
          timestamp: 1052283831865,
          username: 'Cynthia Taylor',
          price: 5374.9,
          status: 'success'
        },
        {
          order_no: 'cbf689eC-D69b-Bb26-5FEe-5f6BB3d21aEa',
          timestamp: 1052283831865,
          username: 'Betty Jackson',
          price: 4935.7,
          status: 'pending'
        },
        {
          order_no: '3377B8F5-FCcb-EcD6-87e1-0B9e4eAF91B1',
          timestamp: 1052283831865,
          username: 'Barbara Jackson',
          price: 7088.8,
          status: 'pending'
        }
      ]
    }
  },
  created() {
    this.loadData()
  },
  methods: {
    loadData() {}
  }
}
</script>
